package com.zy.ipanalysis.service;

import com.zy.ipanalysis.dao.IspMaskDao;
import com.zy.ipanalysis.model.IspMask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * Created by ZYDR on 2015/12/26.
 */
@Service
public class IspMaskService {
    @Autowired
    IspMaskDao ispMaskDao;
    public void insert(IspMask ispMask){
        ispMaskDao.insert(ispMask);
    }
    public List<IspMask> qureyForIsp(int ispId){
        return ispMaskDao.qureyForIsp(ispId);
    }
    public HashMap<Integer,Integer> query4isp(int ispId){
        List<IspMask> ispMasks=ispMaskDao.qureyForIsp(ispId);
        HashMap<Integer,Integer> resultMap=new HashMap<Integer, Integer>();
        for (IspMask ispMask:ispMasks){
            resultMap.put(ispMask.getNetId(),ispMask.getMask());
        }
        return resultMap;
    }
    public IspMask queryByNetId(int netId){
        return ispMaskDao.queryByNetId(netId);
    }
}
